*Democratization and International Border Agreements
*Owsiak, Andrew P.
*2012

*Replication file for results presented in manuscript
tsset ccode year

*Table 1
ttest polity2, by(allsettle)
ttest vandemindex, by(allsettle)
ttest democracy, by(allsettle)
ttest xconst, by(allsettle)
ttest parreg, by(allsettle)
ttest parcomp, by(allsettle)
ttest milper, by(allsettle)
ttest milex, by(allsettle)
ttest amnesty, by(allsettle)
ttest PHYSINT, by(allsettle)
ttest NEW_EMPINX, by(allsettle)

*Table 2, Models 1-5
regress polity2 allsettle lagpolity, cluster(ccode)
regress polity2 allsettle laggdpam laggdpchg lagtradeopen lagmilper lagmilex lagupop lagsumdown lagpolity, cluster(ccode)
regress polity2 allsettle somesettle laggdpam laggdpchg lagtradeopen lagmilper lagmilex lagupop lagsumdown lagpolity, cluster(ccode)
regress vandemindex allsettle lagdemindex, cluster(ccode)
regress vandemindex allsettle laggdpam laggdpchg lagtradeopen lagmilper lagmilex lagupop lagsumdown lagdemindex, cluster(ccode)

*Table 3 (including full model and probabilities presented in the online appendix)
gen dem = polity2 > 5 if polity2 < .
gen aut = polity2 < -5 if polity2 < .
gen part  = dem==0 & aut==0 if polity2 < .
label variable dem "Democracy"
label variable aut "Autocracy"
label variable part "Partial Democracy"

gen tripolx=0 if aut & polity2<.
replace tripolx=1 if part & polity2<.
replace tripolx=2 if dem & polity2<.
lab val tripolx tripolx
by ccode: gen Ltripolx = L.tripolx if year==year[_n-1]+1
lab val Ltripolx tripolx

gen y0 = tripolx<1
gen y1 = tripolx<2
by ccode: gen Ly0 = L.y0 if year==year[_n-1]+1
by ccode: gen Ly1 = L.y1 if year==year[_n-1]+1

gen Lgdpy0 = laggdpam *Ly0
gen Lgdpy1 = laggdpam *Ly1
gen Lgrowthy0 = laggdpchg*Ly0
gen Lgrowthy1 = laggdpchg*Ly1
gen Lurbany0 = lagupop*Ly0
gen Lurbany1 = lagupop*Ly1
gen Ltradey0 = lagtradeopen*Ly0
gen Ltradey1 = lagtradeopen*Ly1
gen Lmilpery0 = lagmilper*Ly0
gen Lmilpery1 = lagmilper*Ly1
gen Lmilexy0 = lagmilex*Ly0
gen Lmilexy1 = lagmilex*Ly1
gen Lsumdowny0 = lagsumdown*Ly0
gen Lsumdowny1 = lagsumdown*Ly1

gen Lpctsety0= allsettle*Ly0
gen Lpctsety1= allsettle*Ly1

oprobit tripolx Ly0 Ly1 allsettle Lpctsety0 Lpctsety1 laggdpam Lgdpy0 Lgdpy1 laggdpchg Lgrowthy0 Lgrowthy1 lagupop Lurbany0 Lurbany1 lagtradeopen Ltradey0 Ltradey1 lagmilper Lmilpery0 Lmilpery1 lagmilex Lmilexy0 Lmilexy1 lagsumdown Lsumdowny0 Lsumdowny1, cluster(ccode)

dis _b[allsettle] + _b[Lpctsety1]
test allsettle+Lpctsety1=0
dis _b[allsettle] + _b[Lpctsety1] + _b[Lpctsety0]
test allsettle+Lpctsety1 + Lpctsety0=0

dis _b[laggdpam] + _b[Lgdpy1]
test laggdpam+Lgdpy1=0
dis _b[laggdpam] + _b[Lgdpy1] + _b[Lgdpy0]
test laggdpam+Lgdpy1 + Lgdpy0=0

dis _b[laggdpchg] + _b[Lgrowthy1]
test laggdpchg+Lgrowthy1=0
dis _b[laggdpchg] + _b[Lgrowthy1] + _b[Lgrowthy0]
test laggdpchg+Lgrowthy1 + Lgrowthy0=0

dis _b[lagupop] + _b[Lurbany1]
test lagupop+Lurbany1=0
dis _b[lagupop] + _b[Lurbany1] + _b[Lurbany0]
test lagupop+Lurbany1 + Lurbany0=0

dis _b[lagtradeopen] + _b[Ltradey1]
test lagtradeopen+Ltradey1=0
dis _b[lagtradeopen] + _b[Ltradey1] + _b[Ltradey0]
test lagtradeopen+Ltradey1 + Ltradey0=0

dis _b[lagmilper] + _b[Lmilpery1]
test lagmilper+Lmilpery1=0
dis _b[lagmilper] + _b[Lmilpery1] + _b[Lmilpery0]
test lagmilper+Lmilpery1 + Lmilpery0=0

dis _b[lagmilex] + _b[Lmilexy1]
test lagmilex+Lmilexy1=0
dis _b[lagmilex] + _b[Lmilexy1] + _b[Lmilexy0]
test lagmilex+Lmilexy1 + Lmilexy0=0

dis _b[lagsumdown] + _b[Lsumdowny1]
test lagsumdown+Lsumdowny1=0
dis _b[lagsumdown] + _b[Lsumdowny1] + _b[Lsumdowny0]
test lagsumdown+Lsumdowny1 + Lsumdowny0=0

estsimp oprobit tripolx Ly0 Ly1 allsettle Lpctsety0 Lpctsety1 laggdpam Lgdpy0 Lgdpy1 laggdpchg Lgrowthy0 Lgrowthy1 lagupop Lurbany0 Lurbany1 lagtradeopen Ltradey0 Ltradey1 lagmilper Lmilpery0 Lmilpery1 lagmilex Lmilexy0 Lmilexy1 lagsumdown Lsumdowny0 Lsumdowny1, cluster(ccode)
setx Ly0 0 Ly1 0 allsettle 0 Lpctsety0 0 Lpctsety1 0 laggdpam mean Lgdpy0 0 Lgdpy1 0 laggdpchg mean Lgrowthy0 0 Lgrowthy1 0 lagupop mean Lurbany0 0 Lurbany1 0 lagtradeopen mean Ltradey0 0 Ltradey1 0 lagmilper mean Lmilpery0 0 Lmilpery1 0 lagmilex mean Lmilexy0 0 Lmilexy1 0
simqi
setx Ly0 0 Ly1 0 allsettle 1 Lpctsety0 0 Lpctsety1 0 laggdpam mean Lgdpy0 0 Lgdpy1 0 laggdpchg mean Lgrowthy0 0 Lgrowthy1 0 lagupop mean Lurbany0 0 Lurbany1 0 lagtradeopen mean Ltradey0 0 Ltradey1 0 lagmilper mean Lmilpery0 0 Lmilpery1 0 lagmilex mean Lmilexy0 0 Lmilexy1 0
simqi
setx Ly0 0 Ly1 1 allsettle 0 Lpctsety0 0 Lpctsety1 0 laggdpam mean Lgdpy0 0 Lgdpy1 0 laggdpchg mean Lgrowthy0 0 Lgrowthy1 0 lagupop mean Lurbany0 0 Lurbany1 0 lagtradeopen mean Ltradey0 0 Ltradey1 0 lagmilper mean Lmilpery0 0 Lmilpery1 0 lagmilex mean Lmilexy0 0 Lmilexy1 0
simqi
setx Ly0 0 Ly1 1 allsettle 1 Lpctsety0 0 Lpctsety1 1 laggdpam mean Lgdpy0 0 Lgdpy1 0 laggdpchg mean Lgrowthy0 0 Lgrowthy1 0 lagupop mean Lurbany0 0 Lurbany1 0 lagtradeopen mean Ltradey0 0 Ltradey1 0 lagmilper mean Lmilpery0 0 Lmilpery1 0 lagmilex mean Lmilexy0 0 Lmilexy1 0
simqi
setx Ly0 1 Ly1 1 allsettle 0 Lpctsety0 0 Lpctsety1 0 laggdpam mean Lgdpy0 0 Lgdpy1 0 laggdpchg mean Lgrowthy0 0 Lgrowthy1 0 lagupop mean Lurbany0 0 Lurbany1 0 lagtradeopen mean Ltradey0 0 Ltradey1 0 lagmilper mean Lmilpery0 0 Lmilpery1 0 lagmilex mean Lmilexy0 0 Lmilexy1 0
simqi
setx Ly0 1 Ly1 1 allsettle 1 Lpctsety0 1 Lpctsety1 1 laggdpam mean Lgdpy0 0 Lgdpy1 0 laggdpchg mean Lgrowthy0 0 Lgrowthy1 0 lagupop mean Lurbany0 0 Lurbany1 0 lagtradeopen mean Ltradey0 0 Ltradey1 0 lagmilper mean Lmilpery0 0 Lmilpery1 0 lagmilex mean Lmilexy0 0 Lmilexy1 0
simqi


drop y0 y1 Ly0 Ly1 Lgdpy0 Lgdpy1 Lgrowthy0 Lgrowthy1 Lurbany0 Lurbany1 Ltradey0 Ltradey1 Lmilpery0 Lmilpery1 Lmilexy0 Lmilexy1 Lpctsety0 Lpctsety1 tripolx Ltripolx dem aut part Lsumdowny0 Lsumdowny1
 
drop b1-b28


*Online Appendix Presented Results
*Table 2.2.1
oprobit xconst allsettle laggdpam laggdpchg lagtradeopen lagmilper lagmilex lagupop lagsumdown L.xconst, cluster(ccode) iter(5000)
oprobit parreg allsettle laggdpam laggdpchg lagtradeopen lagmilper lagmilex lagupop lagsumdown L.parreg, cluster(ccode) iter(5000)
oprobit parcomp allsettle laggdpam laggdpchg lagtradeopen lagmilper lagmilex lagupop lagsumdown L.parcomp, cluster(ccode) iter(5000)
